<?php

namespace App\Admin\Controllers;

use App\Admin\Metrics\ApplicationConfig;
use Dcat\Admin\Admin;
use Dcat\Admin\Layout\Column;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Layout\Row;
use Illuminate\Routing\Controller;

class HomeController extends Controller
{
    public function index(Content $content): Content
    {
        return $content
            ->header('数据看板')
            ->description('系统数据看板')
            ->body(function (Row $row) {
                if (!Admin::user()->isAdministrator()) {
                    $row->column(6, function (Column $column) {
                        $column->row(new ApplicationConfig);
                    });

                    $row->column(6, function (Column $column) {
                    });
                }
            });
    }

}
